{% extends 'SystemAdminBundle:base:main.0.html.twig' %}

{% block content %}
    {% block main %}

        <form method="post" action="" target="mainframe">
        <div id="floatHead" class="content-tab-wrap">
            <div class="content-tab">
                <div class="content-tab-ul-wrap">
                    <ul>
                        <li><a class="selected" href="javascript:;">管理附件</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="tab-content" style="padding-bottom: 90px;">
            {#{{ dump(Attach) }}#}
            <input type="hidden" name="id" value="{{ Attach.id }}" />
            <dl>
                <dt>附件类型</dt>
                <dd>
                    <div class="rule-single-select">
                        <select id="AttachType" name="AttachType"datatype="*">
                            <option value="0" {{ Attach.type == 0 ? "selected='selected'" : "" }}>无附件</option>
                            <option value="1" {{ Attach.type == 1 ? "selected='selected'" : "" }}>图片</option>
                            <option value="2" {{ Attach.type == 2 ? "selected='selected'" : "" }}>音频</option>
                        </select>
                    </div>
                </dd>
            </dl>
            <dl id="AttachType3" class="AttachDataInput" {{ Attach.type == 0 ? "" : 'style="display: none;"' }}>
                <dt>
                    &nbsp;<span style="display: none">没有附件</span>
                </dt>
                <dd>
                    <div>
                        &nbsp;<input name="{{ Attach.type == 0 ? "AttachData" : "" }}" type="hidden" value="0">
                    </div>
                </dd>
            </dl>
            <dl id="AttachType1" class="AttachDataInput" {{ Attach.type == 1 ? "" : 'style="display: none;"' }}>
                <dt>图片附件</dt>
                <dd>
                    <div>
                        <input name="{{ Attach.type == 1 ? "AttachData" : "" }}" type="text" class="input normal upload-path" value="{{ Attach.type == 1 ? Attach.data : "" }}">
                        <div class="upload-box upload-img"></div>
                        <span style="color:#FF0000">*上传图片长宽限制:500*500px,大小限制:100k以内</span>
                    </div>
                </dd>
            </dl>
            <dl id="AttachType2" class="AttachDataInput" {{ Attach.type == 2 ? "" : 'style="display: none;"' }}>
                <dt>音频附件</dt>
                <dd>
                    <input name="{{ Attach.type == 2 ? "AttachData" : "" }}" type="text" id="" class="input normal" datatype="*" value="{{ Attach.type == 2 ? Attach.data : "" }}">
                </dd>
            </dl>
        </div>
        {% block submit %}
            <div class="page-footer">
                <div class="btn-wrap">
                    <input type="submit" value="提交保存" id="btnSubmit" class="btn" />
                    <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
                </div>
            </div>
        {% endblock %}
        </form>
    {% endblock %}
    <!-- 需引入-->
    <script type="text/javascript" charset="utf-8" src="{{ asset("bundles/systemadmin/js/laymain.js")}}"></script>
    {% block script %}
        {#---------------------------------------附件管理JS------------------------------------#}
        <script>
            $("dd").on("change","#AttachType", function () {
                var type = $(this).val();
                $(".AttachDataInput").hide().find("input").attr("name","");
                $("#AttachType" + type).show().find("input").attr("name","AttachData");
            })
        </script>
        {#---------------------------------------附件管理JS------------------------------------#}

        {% include 'SystemAdminBundle:base:inc.js.article.twig' %}
        {% include 'SystemAdminBundle:base:inc.js.pic.upload.twig' %}
    {% endblock %}
{% endblock %}